//
//  CommitCooperationViewController.m
//  AnXin100
//
//  Created by Sakura on 2018/11/6.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "CommitCooperationViewController.h"
#import "UITextView+WZB.h"
#import "ChoicePhotoView.h"
@interface CommitCooperationViewController ()

@property (nonatomic, strong) ChoicePhotoView *choicePhoto;
@property (nonatomic, strong) UIButton *commitBtn;

@end

@implementation CommitCooperationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UILabel *topLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x333333] font:[UIFont systemFontOfSize:16] rect:CGRectMake(10, Hn, SCREEN_WIDTH - 20, 30)];
    topLabel.text = @"请先填写相关信息，客服稍后回复您！";
    [self.view addSubview:topLabel];
    
    CGFloat y = 0;
    NSArray *array = @[@"公司名称", @"姓名", @"电话", @"合作项目"];
    for (NSInteger i = 0; i < array.count; i++) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, Hn + 30 + 40 * i, SCREEN_WIDTH, 40)];
        view.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:view];
        
        UILabel *titleLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x333333] font:[UIFont systemFontOfSize:16] rect:CGRectMake(10, 0, 100, 40)];
        titleLabel.text = array[i];
        [view addSubview:titleLabel];
        
        UITextField *textFeild = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(titleLabel.frame), 5, SCREEN_WIDTH - CGRectGetMaxX(titleLabel.frame) - 10, 30)];
        textFeild.placeholder = @" 请输入相关信息";
        textFeild.textAlignment = NSTextAlignmentCenter;
        textFeild.font = [UIFont systemFontOfSize:14];
        textFeild.textColor = [UIColor colorWithHex:0x333333];
        textFeild.layer.cornerRadius = 5;
        textFeild.layer.borderColor = [UIColor colorWithHex:0xf5f5f5].CGColor;
        textFeild.layer.borderWidth = 1;
        [view addSubview:textFeild];
        y = CGRectGetMaxY(view.frame);
    }
    
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(10, y + 10, SCREEN_WIDTH - 20, 160)];
    textView.wzb_placeholder = @"备注：";
    textView.wzb_placeholderColor = [UIColor colorWithHex:0x999999];
    textView.layer.cornerRadius = 5;
    textView.layer.borderWidth = 1;
    textView.layer.borderColor = [UIColor colorWithHex:0xf5f5f5].CGColor;
    [self.view addSubview:textView];

    _choicePhoto = [[ChoicePhotoView alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(textView.frame) + 10, SCREEN_WIDTH - 20, self.view.height_sd - 44 - CGRectGetMaxY(textView.frame) - 20)];
    _choicePhoto.backgroundColor = [UIColor whiteColor];
    _choicePhoto.viewController = self;
    _choicePhoto.takingPictures = YES;
    _choicePhoto.choicePictures = YES;
    _choicePhoto.choiceViedos = NO;
    _choicePhoto.orginalImage = NO;
    _choicePhoto.GIF = NO;
    _choicePhoto.takeBtn = YES;
    _choicePhoto.tailoring = NO;
    _choicePhoto.CircularCut = NO;
    _choicePhoto.multiSelectViedoAndGif = NO;
    _choicePhoto.recordViedo = NO;
    _choicePhoto.showNumber = YES;
    _choicePhoto.maxChoiceImage = 9;
    _choicePhoto.lineImageNumber = 4;
    _choicePhoto.type = Longitudinal;
    [self.view addSubview:_choicePhoto];
    [self.view addSubview:self.commitBtn];
}

- (UIButton *)commitBtn {
    if (!_commitBtn) {
        _commitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _commitBtn.frame = CGRectMake(0, SCREEN_HEIGHT - 44, SCREEN_WIDTH, 44);
        [_commitBtn setTitle:@"确认提交" forState:UIControlStateNormal];
        _commitBtn.backgroundColor = COLOR_ORG;
    }
    return _commitBtn;
}

@end
